<template>
    <div>
        <span><el-button type="primary" @click="back">返回列表</el-button></span>
        <el-row style="margin-top: 20px;margin-bottom: 5px">
            <el-col span="4">
                <div style="font-size: 30px;font-weight: bold">基本资料</div>
            </el-col>
            <el-col span="2" :offset=18>
                <el-button v-print="'#printTest'">打印</el-button>
            </el-col>
        </el-row>
        <div id="printTest">
        <table border="1" cellpadding="0" cellspacing="0" class="case_table">
            <tr>
                <td>
                    <span>案号</span>:<br>
                    {{caseData[0].caseNo}}
                </td>
                <td>
                    <span>提交时间</span>:<br>
                    {{caseData[0].caseSubtime}}
                </td>
                <td>
                    <span>案件类型:</span><br>
                    {{caseData[0].caseCaseTypeName}}
                </td>
                <td>
                    <span>收案时间:</span><br>
                    {{caseData[0].collectionTime}}
                </td>
            </tr>
            <tr>
                <td>
                    <span>委托人:</span><br>
                    {{caseData[0].caseWtr}}
                </td>
                <td>
                    <span>对方当事人:</span><br>
                    {{caseData[0].caseOppositeParties}}
                </td>
                <td>
                    <span>承办律师:</span><br>
                    {{caseData[0].caseAttorney}}
                </td>
                <td>
                    <span>诉讼地位:</span><br>
                    {{caseData[0].caseLawsuitStatus}}
                </td>
            </tr>
            <tr>
                <td>
                    <span>诉讼阶段:</span><br>
                    {{caseData[0].caseStatus}}
                </td>
                <td>
                    <span>诉讼标的:</span><br>
                    {{caseData[0].caseLawsuitobj}}
                </td>
                <td>
                    <span>代理费:</span><br>
                    {{caseData[0].caseAgencyfee}}
                </td>
                <td>
                    <span>收费方式:</span><br>
                    {{caseData[0].caseChargeWay}}
                </td>
            </tr>
            <tr>
                <td>
                    <span>是否享受政府补助:</span><br>
                    {{caseData[0].caseSubsidy==='Y'?'是':'否'}}
                </td>
                <td>
                    <span>补助金额:</span><br>
                    {{caseData[0].caseSubsidysal}}
                </td>
                <td>
                    <span>收案审批状态:</span><br>
                    {{caseData[0].caseApproveStatus==='1'?'审批中':(caseData[0].caseApproveStatus==='3'?'审批不通过':'审批通过')}}
                </td>
                <td>
                    <span>结案状态:</span><br>
                    {{caseData[0].caseSettleStatus==='Y'?'已结案':'未结案'}}
                </td>
            </tr>
            <tr>
                <td>
                    <span>风险费:</span><br>
                    {{caseData[0].caseFxmoney}}
                </td>
                <td>
                    <span>杂费:</span><br>
                    {{caseData[0].caseProxysal}}
                </td>
                <td>
                    <span>受理机关:</span><br>
                    {{caseData[0].acceptName}}
                </td>
                <td>
                    <span>受理法院:</span><br>
                    {{caseData[0].courtName}}
                </td>
            </tr>
            <tr>
                <td>
                    <span>案由:</span><br>
                    {{caseData[0].caseCause}}
                </td>
                <td>
                    <span>总费用:</span><br>
                    {{caseData[0].caseAgencyfee+caseData[0].caseFxmoney+caseData[0].caseProxysal}}
                </td>
                <td>
                    <span>申请减免金额:</span><br>
                    {{caseData[0].standard}}
                </td>
                <td>
                    <span>剩余未付:</span><br>
                    {{caseData[0].caseAgencyfee+caseData[0].caseFxmoney+caseData[0].caseProxysal-caseData[0].caseSubsidysal
                    -caseData[0].standard-caseData[0].casePaidsal}}
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <span>备注:</span><br>
                    {{caseData[0].caseRemarks===''?'暂无备注':caseData[0].caseRemarks}}
                </td>
            </tr>
        </table>
        <div style="margin-top: 50px;font-size: 30px;font-weight: bold">承办律师</div>
        <el-table
                class="el-case_table"
                :data="lawyers"
                border
                style="width: 99%;">
            <el-table-column
                    prop="caseAttorney"
                    label="类型"
                    width="300"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="empName"
                    label="律师姓名"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="cwPerformancesplit"
                    label="业绩分成"
                    width="300"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="cwSplitType"
                    label="分成方式"
                    align="center">
            </el-table-column>
        </el-table>
        <div style="margin-top: 50px;font-size: 30px;font-weight: bold">费用减免申请</div>
        <el-table
                :data="decreaseData"
                border
                style="width: 99%;">
            <el-table-column
                    prop="applyDate"
                    label="申请日期"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="decreaseMoney"
                    label="减免金额"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="person"
                    label="申请人"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="reason"
                    label="减免事由"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="approveStatus"
                    label="审批状态"
                    align="center"
                    :formatter="approveFormatter">
            </el-table-column>
        </el-table>
        <div style="margin-top: 50px;font-size: 30px;font-weight: bold">公函记录</div>
        <el-table
                :data="sealApplyfor"
                border
                style="width: 99%;">
            <el-table-column
                    prop="caseNo"
                    label="案号"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="applyforRecipient"
                    label="领用人"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="sendPerson"
                    label="收函方"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="itemName"
                    label="用印事项"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="applyforReceive"
                    label="领用日期"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="applyforApprovalStatus"
                    label="审批状态"
                    align="center"
                    :formatter="approveFormatter">
            </el-table-column>
        </el-table>
        </div>
    </div>
</template>

<script>
    import AddCaseService from "../../model/AddCaseService";


    const addCaseService=AddCaseService.getInstance();
    export default {
        name: "CaseDetails",
        props:[
          'caseId',
            'caseRecycle'
        ],
        data(){
            return{
                caseData:[],//案件表格数据
                lawyers:[],//办案律师数据
                sealApplyfor:[],//用印申请数据
                decreaseData:[],//费用减免数据
            }
        },
        created() {
            this.init()
        },
        methods:{
            back(){//返回按钮
                this.$emit("back")
            },
            init(){
                this.$loading({//懒加载
                    lock: true,
                    text: '正在查询...',
                    spinner: 'fa fa-refresh fa-spin fa-3x',
                    background: 'rgba(0, 0, 0, 0.7)'
                });
                let params;
                if(this.caseRecycle===undefined){
                    params={
                        id:this.caseId
                    };
                }else{
                    params={
                        id:this.caseId,
                        caseRecycle:"N"
                    };
                }
                addCaseService.querySenior(this.$http,params).then(msg=>{//案件
                    this.caseData=msg.data.data.list;
                    this.$loading().close()
                });
                addCaseService.queryCaseSeal(this.$http,params).then(msg=>{//用印申请
                    this.sealApplyfor=msg.data.data;
                });
                addCaseService.queryCwPerformancesplit(this.$http,params).then(msg=>{//办案律师
                    this.lawyers=msg.data.data;
                });
                const param2={
                    caseLawId:this.caseId
                };
                addCaseService.queryDecrease(this.$http,param2).then(msg=>{//费用减免
                    this.decreaseData=msg.data.data.list
                })
            },
            approveFormatter(row, column, cellValue){//收案审批状态
                if(parseInt(cellValue)===1){
                    return "审批中"
                }else if(parseInt(cellValue)===2){
                    return "审批通过"
                }else{
                    return "审批不通过"
                }
            },
        }
    }
</script>

<style scoped>
    .case_table{
        border-collapse: collapse;
        width: 99%;
    }
    .case_table,.case_table td{
        border: 1px solid gainsboro;
    }
    .case_table td{
        padding: 20px 20px 20px 10px;
    }
    .case_table span{
        color: #777777;
    }
</style>